# My solution
month = input("Enter the month('January', ...,'December'): ")
day = input("Enter the start day ('Monday', ..., 'Sunday'): ")

max = 0
buffer = 0

if month == "January":
    max = 31
elif month == "February":
    max = 28
elif month == "March":
    max = 31
elif month == "April":
    max = 30
elif month == "May":
    max = 31
elif month == "June":
    max = 30
elif month == "July":
    max = 31
elif month == "August":
    max = 31
elif month == "September":
    max = 30
elif month == "October":
    max = 31
elif month == "November":
    max = 30
elif month == "December":
    max = 31

if day == "Monday":
    buffer = 1
if day == "Tuesday":
    buffer = 0
if day == "Wednesday":
    buffer = -1
if day == "Thursday":
    buffer = -2
if day == "Friday":
    buffer = -3
if day == "Saturday":
    buffer = -4
if day == "Sunday":
    buffer = -5


#for n in range(buffer,max,7):
#    for o in range(n,n+7):
#        if n<1:
#            print(format(" ", "2"), "", end="")
#        print(format(o, "2"),"", end="")
#    print()

print(month)
print("Mo Tu We Th Fr Sa Su")
j = 0
i = 0
line = ""
n = buffer
while (j<6):
    while(i<7):
        if(max<n):
            break
        if i!=0:
            line = line+" "
        if n<1:
            line = line+format(" ", "2")
        else:
            line = line+format(n, "2")
        i = i+1
        n = n+1
    print(line)
    i = 0
    line = ""
    j = j+1